<?php

/**
 * NOTICE OF LICENSE
 *
 * THIS SOURCE FILE IS PART OF EVEBIT'S PRIVATE PROJECT.
 * 
 * DO NOT USE THIS FILE IN OTHER PLACE.
 *
 * @package   App_Backend
 * @author    Cheng Wei <berlios.o@gmail.com>
 * @version   $$Id: Config.php 20 2010-12-18 09:35:07Z cheng.wei $$
 * @copyright Copyright (c) 2008 Evebit Inc. China (http://www.evebit.com)
 */

/**
 * Model configuration
 * 
 * @package   App_Backend
 * @author    Cheng Wei <berlios.o@gmail.com>
 * @version   $$Id: Config.php 20 2010-12-18 09:35:07Z cheng.wei $$
 */
class Default_Model_Entity_Config extends Evebit_Model_Abstract {
	
	/**
	 * Load configuration from database
	 * 
	 * @return array
	 */
	public function loadConfigurations() {
		return $this->getResource()->loadConfigurations();
	}
	
	/**
	 * @return array
	 */
	public function getOptionsArray() {
		$source = $this->getSource();
		if (!$source || !class_exists($source)) {
			return null;
		}
		$source = new $source();
		return $source->getOptionsArray();
	}
	
	public function getCodeValue($code = null, $default = null){
	    if ($code === null){
    		return null;
    	}
		return $this->getResource()->getCodeValue($code, $default);
	}

}